package com.itheima.controller;

import com.itheima.common.dto.SetmealDto;
import com.itheima.common.entity.PageResult;
import com.itheima.common.entity.Result;
import com.itheima.controller.backend.controller.SetmealController;
import com.itheima.pojo.Setmeal;
import com.itheima.service.ISetmealService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * 套餐Controller
 *
 * @author itheima
 * @date 2025-03-23
 */
@RestController
@RequestMapping("/setmeal")
public class UserSetmealController {
    private static final Logger log = LoggerFactory.getLogger(SetmealController.class);
    @Autowired
    private ISetmealService setmealService;

    /**
     * 查询套餐列表
     *
     * @return
     */
    @PostMapping("/getSetmeal")
    public Result getSetmeal() {
        List<Setmeal> setmealList = setmealService.selectList();
        return new Result(true, "查询套餐数据成功", setmealList);
    }

    /**
     * 查询套餐详情
     *
     * @param id
     * @return
     */
    @PostMapping("/findById")
    public Result findById(Integer id) {
        Setmeal setmeal = setmealService.selectDetilesById(id);
        return new Result(true, "查询套餐成功", setmeal);
    }


}
